package com.colin.jipay.activity;

import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.widget.EditText;
import android.widget.Toast;

import com.colin.jipay.BaseActivity;
import com.colin.jipay.R;
import com.colin.jipay.utils.AbSharedUtil;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

public class SettingActivity extends BaseActivity {

    @BindView(R.id.accountid)
    EditText accountid;
    private String mAccountId;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_setting);
        ButterKnife.bind(this);

        mAccountId = AbSharedUtil.getString(this,"accountid");
        if (!TextUtils.isEmpty(mAccountId)){
            accountid.setText(mAccountId);
        }
    }

    @OnClick({R.id.save, R.id.back})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.save:
                String _accountid= accountid.getText().toString();
                if (TextUtils.isEmpty(_accountid)){
                    Toast.makeText(this,"accountid不能为空 !",Toast.LENGTH_LONG).show();
                    return;
                }
                AbSharedUtil.putString(this,"accountid",_accountid);
                Toast.makeText(this,"保存成功!",Toast.LENGTH_LONG).show();
                finish();
                break;
            case R.id.back:
                finish();
                break;
        }
    }
}
